
<%= form_with scope: :article, url: articles_path, local: true do |form| %>

  <% if @article.errors.any? %>
    <div id="error_explanation">
      <h2>
        <%= pluralize(@article.errors.count, "error")  %>
        prohibited
        this article from being saved:
      </h2>
      <ul>
        <% @article.errors.full_messages.each do |msg| %>
          <li><%= msg %></li>
        <% end %>
      </ul>
    </div>
  <% end %>
  <p>
    <h2><%= form.label :标题 %></h2>
    <%= form.text_field :title , class:"form-control"%>
  </p>

  <p>
    <h2><%= form.label :内容 %></h2>
    <%= form.text_area :text, class:"form-control" %> <br>
  </p>


  <p>
    <%= form.submit"发表博客",class:"btn btn-primary" %>
  </p>
<% end %>

<%= link_to '返回', articles_path ,class:"btn btn-primary"%>